/**
 * Created by JuntaoYi
 * Date 2020/3/30
 */
import React ,{ Component }from 'react';

class Toggle extends Component {
    constructor(props) {
        super(props);
        this.state = {
            isToggleOn: false
        }
    }
    handClick = (num) => {
        console.log(num)
        this.setState(state => ({
            isToggleOn : !state.isToggleOn
        }))
    }
    render() {
        return (
            <button onClick={() => this.handClick(11)}>
                {this.state.isToggleOn ? 'ON' : 'OFF'}
            </button>
        )
    }
}
export default Toggle;
